package com.heze.xunhuan.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * 应用配置类
 *
 * @author heze-xunhuan
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "app")
public class AppConfig {

    /**
     * JWT配置
     */
    private Jwt jwt = new Jwt();

    /**
     * 微信配置
     */
    private Wechat wechat = new Wechat();

    /**
     * 文件配置
     */
    private File file = new File();

    /**
     * MinIO配置
     */
    private Minio minio = new Minio();

    /**
     * 业务配置
     */
    private Business business = new Business();

    @Data
    public static class Jwt {
        private String secret;
        private Long expiration;
        private Long refreshExpiration;
    }

    @Data
    public static class Wechat {
        private String appid;
        private String secret;
    }

    @Data
    public static class File {
        private String uploadPath;
        private String accessUrl;
        private Oss oss = new Oss();

        @Data
        public static class Oss {
            private Boolean enabled;
            private String endpoint;
            private String accessKeyId;
            private String accessKeySecret;
            private String bucketName;
        }
    }

    @Data
    public static class Minio {
        private String endpoint;
        private String accessKey;
        private String secretKey;
        private String bucketName;
    }

    @Data
    public static class Business {
        private Integer dailyPostLimit;
        private Integer vipDailyPostLimit;
        private Integer imageLimit;
        private Integer videoDurationLimit;
        private Integer vipVideoDurationLimit;
        private Integer postExpireDays;
    }
}